USE [NGroup.VTL.DB]
GO

/****** Object:  StoredProcedure [dbo].[GetUserList]    Script Date: 12/25/2013 22:42:56 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[GetUserList]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[GetUserList]
GO

USE [NGroup.VTL.DB]
GO

/****** Object:  StoredProcedure [dbo].[GetUserList]    Script Date: 12/25/2013 22:42:56 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO


-- =============================================
-- Author:		Bui Thanh Nam
-- Create date: 20131223
-- Description:	Get list of users
-- =============================================
CREATE PROCEDURE [dbo].[GetUserList]
	@PageIndex			INT = 1,
	@PageSize			INT = 12,	
	@TotalRows			INT = 0 OUTPUT,
	@Permission			INT = 9
AS
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON;

	SELECT 
		 [ID]
		,[RoleID]
		,[Username]
		,[Password]
		,[IsActive]
		,[CreatedAt]
		,[CreatedBy]
		,[LastUpdatedAt]
		,[LastUpdatedBy]
	FROM [NGroup.VTL.DB].[dbo].[Users] WITH (NOLOCK)
	WHERE [RoleID] >= @Permission
END


GO

